function[g] = generatorPre(TP, n)

dim = length(TP);
I = eye(dim, dim);
g = zeros(dim, dim);
for k = 1:n
    g = g + (-1)^(k+1)* mpower(TP - I,k)/k;
end
end
